s = "5,20,6,20,7,21,8,22,9,24,10,26,11,28,12,29,13,31,14,31,15,32,16,32"
raw_values = [int(v) for v in s.split(",")]
timed_values = list(zip(raw_values[::2], raw_values[1::2]))

s = 0
with open("temData.txt", "w") as file:
    file.write("时间\t温度\n")
    for k, v in timed_values:
        file.write(f"{k}点\t{v}度\n")
        s += v
    count = len(timed_values)
    file.write(f"{count}个小时的平均气温为{s / count:.2f}度")
